<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 100px;
            height: 100px;
            padding: 20px;
            border: 30px solid red;
            border-top: 55px solid red;
            background-color: springgreen;
            /* margin: 50px; */
            margin-top: 99px;
            margin-left: 98px;
        }
    </style>
</head>
<body>
    <div></div>
    <script>
        /* 本质就是获取边框的宽高 */
        var div = document.querySelector("div")
        // console.log(div.offsetTop,div.offsetLeft);
        // console.log(div.clientTop,div.clientLeft);
        console.log(div.clientWidth,div.clientHeight);
    </script>
</body>
</html>